		<div class="clearfix form-actions center" style="margin-top:15px;margin-bottom:5px;">
			<div class="col-md-offset-1 col-md-10">
			#if(btn_save)
			  	<button class="btn btn-info" type="button" id="btn_save" onclick="save()">
					<i class="ace-icon fa fa-check bigger-110"></i>
					#(btn_save??)
				</button>
			#end

			#if(btn_close)
				&nbsp; &nbsp; &nbsp;
				<button class="btn" type="button" id="btn_close">
					<i class="ace-icon fa fa-close bigger-110"></i>
					#(btn_close??)
				</button>
			#end
			</div>
		</div>
		<script type="text/javascript">
			var layerIndex = parent.layer.getFrameIndex(window.name); //获取窗口索引
			function save(){
				var flag = checkParam();
				if(!flag){
					return;
				}
				if($("#form_token").val()==0){
					layer.alert("表单并未修改请勿提交!", {icon: 7,title:"提示"});
					return false;
				}
				if( typeof saveBefore === 'function' ){
					saveBefore();
		        }
				$("#btn_save").attr("disabled","disabled");
				var appindex = appLoading();
				var $form = $("form");
				var ajax = new $ax($form.attr("data-url"), function(data){
					if (data.state == 'ok') {
						clearLoading(appindex);
						layer.msg(data.msg, {icon: 1});
						setTimeout(function(){
							closeTab(true);
						},500);
						return false;
					} else {
						clearLoading(appindex);
						$("#btn_save").removeAttr("disabled","disabled");
						if(data.state == 'fail'){
							layer.alert(data.msg, {icon: 5,title:"发生错误"});
						}
						else{
							layer.msg(data.msg, {icon: 2,time:2000});
						}
						return false;
					}
				});
				ajax.data = $form.serialize();
				ajax.start();
				return false;
			}
			
			$("#btn_close").bind("click",function(){
				closeTab(("#(auto_close??)" == "true") ? true : false);
			});
			
			function closeTab(isReload){
				//未找到layerIndex代表为新增tab页
				if(typeof (layerIndex) == "undefined"){
					var tabId = "";
					var dataUrl = $("form").attr("data-url");
					if(typeof (dataUrl) == "undefined"){
						tabId = "btn_#(code)_view_#(id??)";
					}else if(dataUrl.indexOf("save") > 0){
						tabId = "btn_#(code)_add";
					}else if(dataUrl.indexOf("update") > 0){
						tabId = "btn_#(code)_edit_#(id??)";
					}else{
						tabId = "btn_#(code)_view_#(id??)";
					}
					if(isReload){
						window.top.reloadTabById("#(code??)")
					}
					window.top.autoClose(tabId,"#(code??)");
				} else{
					if(isReload){
						parent.searchGrid();
					}
					parent.layer.close(layerIndex);
				}
			}
	</script>